import { Column, Entity, JoinColumn, ManyToMany, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { Menu } from "./menu.entity";
import { Role } from "src/modules/role/entities/role.entity";

@Entity()
export class Permission {
  @PrimaryGeneratedColumn()
  id: string;

  @Column()
  name: string;

  @Column()
  path: string;

  @ManyToOne((type) => Menu, menu => menu.permission)
  menu: Menu;

  @ManyToMany(type => Role, role => role.permission)
  role: Role[];
}